<input id="status" name="status" type="hidden" value="{$params.status}"/>
<input id="p" name="p" type="hidden" value="{$p}" />
<table class="table table-bordered">
    <thead>
    <tr>
        <th width="6%">评论ID</th>
        <th>评论内容</th>
        <th width="9%">评论用户ID</th>
        <th width="8%" >评论用户</th>
        <th width="6%" >日报ID</th>
        <th width="8%" >评论状态</th>
        <th width="8%" >被举报次数</th>
        <th width="15%">评论时间</th>
        <th width="8%" >操作</th>
    </tr>
    </thead>
    <tbody>
    <volist name="comment" id="vo" key="k">
        <tr>
            <td>{$vo.comment_id}</td>
            <td>{$vo.content}</td>
            <td>{$vo.user_id}</td>
            <td>{$vo.mobile}</td>
            <td>{$vo.article_id}</td>
            <td>
                <if condition="$vo['status'] eq 1">
                    启用
                <else/>
                    违规禁用
                </if>
            </td>
            <td>{$vo.report_num}</td>
            <td>{$vo.create_time|date="Y-m-d H:i:s", ###}</td>
            <td>
                <if condition="$vo['status'] eq 1">
                    <a href="javascript:;" onclick="changeStatus({$vo.comment_id}, 3);">违规禁用</a>
                </if>
            </td>
        </tr>
    </volist>
    </tbody>
</table>
<div class="pageFaye"><div class="pager">{$page}</div><div class="clear"></div></div>

<script>
    function changeStatus(comment_id, status){
        if(status == 1){
            var message = '启用';
        }else{
            var message = '禁用';
        }

        if(confirm('确定' + message + '该评论吗?')){
            $.post('/comment/expertArticleCommentStatus', {comment_id:comment_id, status:status}, function(data){
                if(data.code == 200){
                    alert('评论' + message + '成功');
                    searchList();
                }else{
                    alert('评论' + message + '失败,请重试');
                }
            }, 'json');
        }

    }
</script>